package com.soilflow.info.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.soilflow.common.annotation.DataScope;
import com.soilflow.common.domain.LandAuctionDeposit;
import com.soilflow.common.domain.LandPaymentPlan;
import com.soilflow.common.domain.dto.LandPaymentPlanDto;
import com.soilflow.common.domain.vo.LandPaymentPlanVo;
import com.soilflow.info.mapper.LandAuctionDepositMapper;
import com.soilflow.info.mapper.LandPaymentPlanMapper;
import com.soilflow.info.service.LandAuctionDepositService;
import com.soilflow.info.service.LandPaymentPlanService;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class LandPaymentPlanServiceImpl extends ServiceImpl<LandPaymentPlanMapper, LandPaymentPlan> implements LandPaymentPlanService {

    @Override
    @DataScope(deptAlias = "lpp")
    public List<LandPaymentPlanVo> getList(LandPaymentPlanDto dto) {
        List<LandPaymentPlanVo> list = baseMapper.getList(dto);
        Date today = new Date();
        for (LandPaymentPlanVo landPaymentPlanVo : list) {
            // 2023-12-10  , 2023-12-11
            if (landPaymentPlanVo.getEndTime().before(today) && landPaymentPlanVo.getStatus().equals("0")){
                landPaymentPlanVo.setBeOverdueStatus("1");
            }else {
                landPaymentPlanVo.setBeOverdueStatus("0");
            }
        }
        return list;
    }
}
